package tc.de.krawallmann.persistence;

/**
 * The class XMLPersistenceException.<br/>
 * Exceptions of this type are thrown in case of problems during serialization.
 * 
 * @author KrawallMann
 * @version 1.0
 */
public class XMLPersistenceException extends Exception {

	/** the SerialVersionUID used for serialization. */
	private static final long serialVersionUID = -977936408096503427L;

	/** The message. */
	private transient final String message;

	/**
	 * Instantiates a new XMLPersistenceException.
	 * 
	 * @param exception
	 *            the exception that make this Exception occur
	 */
	public XMLPersistenceException(final Exception exception) {
		super();
		message = exception.getMessage();
	}

	/**
	 * Instantiates a new XMLPersistenceException.
	 * 
	 * @param message
	 *            the message to be used for this Exception
	 */
	public XMLPersistenceException(final String message) {
		super();
		this.message = message;
	}

	/*
	 * (non-Javadoc)
	 * @see java.lang.Throwable#getMessage()
	 */
	@Override
	public String getMessage() {
		return "Error while performing an xml persistence operation.\n" + message;
	}

}
